package com.hdaccp.dingdan.dao;

import com.hdaccp.pojo.po.Dingdan;
import com.hdaccp.pojo.po.Dingdanxq;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface DingdanDao extends JpaRepository<Dingdan,String> {
//    @Query(value = "SELECT * FROM ddinfo WHERE uid=:uid",nativeQuery = true)
//    public List<Dingdan> queryDingdanBy(@Param("uid") int uid);
    //根据用户id查询订单
    public List<Dingdan> findByuid(@Param("uid") int uid);
    //根据id删除订单
    @Query(value = "DELETE FROM ddinfo WHERE ddid=:ddid",nativeQuery = true)
    public String dingdandelete(@Param("ddid") String ddid);


//    //根据id查询修改订单状态
//    @Query(value = "UPDATE ddinfo SET ddstate=1 WHERE ddid=:ddid",nativeQuery = true)
//    public String updatestate(String ddid);


    //根据单号查询订单
    @Query(value = "SELECT * FROM ddinfo WHERE ddid=:ddid",nativeQuery = true)
    public List<Dingdan> findByddid(@Param("ddid") String ddid);

    //根据用户名模糊查询订单
    @Query(value = "SELECT * FROM ddinfo WHERE shren LIKE %:shren%",nativeQuery = true)
    public List<Dingdan> findByshren(@Param("shren") String shren);










}
